﻿using System.ComponentModel.Composition;
using iStudio.Structure.Command;

namespace iStudio.Module.PhaseVocoder
{
    [Export(typeof(Structure.Engine.Module))]
    public class PhaseVocoderModule : Structure.Engine.Module
    {
        public PhaseVocoderModule()
        {
            //
            // Hooking the module commands into main user interface
            //
            // Description sheet to receive commands
            // -> TrackEditor - track editor context menu
            // -> TreeFunctions -> function tree dock
            // -> TreeEffects -> effect tree dock
            // -> The rest -> top menu
            //
            // Note that main menu cannot have same nodes, such as: Functions/Functions/Functions/Something,
            // this would render into Functions/Something.
            //
            //
            // Do not forget to add path to menu names too,
            //

            AddCommand ("PhaseVocoder", "Change speed or pitch", ModuleCommandType.FromCommandId ("TrackEditorSelect"));
            AddCommand ("PhaseVocoder", "Functions/Speed and Pitch", ModuleCommandTypes.MainMenu);

            //
            // ModuleCommandType -> TrackEditorSelect - represents select tool in track editor
            //
        
            SetupModuleWindow (new PhaseVocoderWindow (this));
        }

        protected override void OnExecutedCommand(ModuleCommand command)
        {
            switch (command.Name)
            {
                case "PhaseVocoder":
                    OpenModuleWindow ();
                    break;
            }
        }
    }
}
